﻿<UserControl x:Class="Startup.Shell.Modules.WindowDesignerModule.WindowDesignerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:WindowDesignerModule="clr-namespace:Startup.Shell.Modules.WindowDesignerModule"
             xmlns:PreviewDesignerHierarchyModule="clr-namespace:Startup.Shell.Modules.PreviewDesignerHierarchyModule"
             xmlns:ModelDesignerPreview="clr-namespace:Startup.Shell.ModelDesignerPreview" mc:Ignorable="d" d:DataContext="{x:Static WindowDesignerModule:WindowDesignerViewModel.Designer}"
             d:DesignHeight="441" d:DesignWidth="651">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

		<GridSplitter Grid.Column="1" Grid.RowSpan="2" Width="3" HorizontalAlignment="Left" VerticalAlignment="Stretch"/>
        <PreviewDesignerHierarchyModule:PreviewDesignerHierarchyCtrl DataContext="{Binding MainWindowViewModel}" Margin="3,0,0,0" Grid.Column="1" Grid.RowSpan="2"/>

        <ItemsControl Grid.Row="1" HorizontalAlignment="Stretch">
            <ItemsControl.ItemsSource>
                <Binding Path="DomainProperties"/>
            </ItemsControl.ItemsSource>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel HorizontalAlignment="Stretch"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Border BorderBrush="Black" BorderThickness="1" Margin="3" PreviewMouseMove="OnImageMouseMove" PreviewMouseLeftButtonDown="OnImageMouseLeftButtonDown">
                        <TextBlock Text="{Binding Name}" Padding="2"/>
                    </Border>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
        
		<ScrollViewer>
			<ItemsControl HorizontalAlignment="Stretch">
				<ItemsControl.ItemsSource>
					<x:StaticExtension Member="ModelDesignerPreview:WindowDesignerPreview.AllPreviews"/>
				</ItemsControl.ItemsSource>
				<ItemsControl.ItemsPanel>
					<ItemsPanelTemplate>
						<StackPanel HorizontalAlignment="Stretch"/>
					</ItemsPanelTemplate>
				</ItemsControl.ItemsPanel>
				<ItemsControl.ItemTemplate>
					<DataTemplate>
						<Image Source="{Binding PreviewImage}" Width="150" Height="150" PreviewMouseMove="OnImageMouseMove" 
							   PreviewMouseLeftButtonDown="OnImageMouseLeftButtonDown"/>
					</DataTemplate>
				</ItemsControl.ItemTemplate>
			</ItemsControl>
		</ScrollViewer>
	</Grid>
</UserControl>
